import { BrowserRouter as Router, Routes, Route } from 'react-router-dom'

import Home from '../views/Home'
import Music from '../views/Music'
import Detail from '../views/Detail'

const routes = [
    {
        path: '/',
        element: <Home />
    },
    {
        path: '/music',
        element: <Music />
    },
    {
        path: '/detail',
        element: <Detail />
    }
]

function RouterView() {
    return (
        <Router>
            <Routes>
                {routes.map(item => {
                    return (<Route key={item.path} path={item.path} element={item.element}></Route>)
                })}
            </Routes>
        </Router>
    )
}
export default RouterView